import { NestFactory } from '@nestjs/core'
import { AppModule } from './app.module'
import { TransformInterceptor } from './common/interceptor/transform.interceptor'
import { HttpExceptionFilter } from './common/filter/http-exception.filter'
import { PORT } from './common/constants'
import { initServer } from './initServer'

async function bootstrap() {
  const app = await NestFactory.create(AppModule, { cors: true })
  app.useGlobalInterceptors(new TransformInterceptor())
  app.useGlobalFilters(new HttpExceptionFilter())
  await app.listen(PORT)

  initServer()
}
bootstrap()
